package org.example.everyday;

public class Lc258 {

    public static void main(String[] args) {
        Lc258 lc258 = new Lc258();
        lc258.addDigits(38);
    }

    public int addDigits(int num) {
        while (num >= 10){
            int sum = 0;
            while (num > 0){
                sum += num % 10;
                num /= 10;
            }
            num = sum;
        }
        return num;
    }

}
